<?php
require_once '../sub/init.php';
define('ZEAI2',dirname(__FILE__).DIRECTORY_SEPARATOR);
require_once 'chkUadm.php';
if(!in_array('u_print',$QXARR))exit(noauth());
require_once ZEAI.'cache/udata.php';$sex_ARR = json_decode($_UDATA['sex'],true);$extifshow = json_decode($_UDATA['extifshow'],true);
require_once ZEAI.'cache/config_wxgzh.php';
if ( !ifint($uid))alert_adm("客户UID不正确","back");
$row = $db->ROW(__TBL_USER__,"*","id=".$uid,"name");
if(!$row)alert_adm("UID输入有误或不存在此客户","back");
$row_ext = $row;
//
$uname   = dataIO($row['uname'],'out');
$truename   = dataIO($row['truename'],'out');
$aboutus    = trimhtml(dataIO($row['aboutus'],'out'));
$birthday   = $row['birthday'];
$birthday   = (!ifdate($birthday))?'':$birthday;
$age        = (getage($birthday)>0)?'（'.getage($birthday).'岁）':'';
$RZ         = $row['RZ'];$RZarr = explode(',',$RZ);
$areaid     = dataIO($row['areaid'],'out');
$areatitle  = dataIO($row['areatitle'],'out');
$area2title = dataIO($row['area2title'],'out');
$heigh      = $row['heigh'];
$weigh      = $row['weigh'];
$love       = $row['love'];
$edu        = $row['edu'];
$pay        = $row['pay'];
$house      = $row['house'];
$car        = $row['car'];
$nation     = $row['nation'];
$marrytype  = $row['marrytype'];
$job        = $row['job'];
$child      = $row['child'];
$blood      = $row['blood'];
$tag        = $row['tag'];
$tguid      = $row['tguid'];
$tgpic      = $row['tgpic'];
$kind       = $row['kind'];
$marrytime  = $row['marrytime'];

$agenttitle= dataIO($row['agenttitle'],'out');
$admname   = dataIO($row['admname'],'out');
$hnname    = dataIO($row['hnname'],'out');
$hnname2   = dataIO($row['hnname2'],'out');
$agentid   = intval($row['agentid']);
$admid     = intval($row['admid']);
$hnid      = intval($row['hnid']);
$hnid2     = intval($row['hnid2']);
$admtime   = intval($row['admtime']);
$hntime    = intval($row['hntime']);
$hntime2   = intval($row['hntime2']);
$hnbbs     = dataIO($row['hnbbs'],'out');

$crm_ukind = $row['crm_ukind'];
$crm_ugrade = $row['crm_ugrade'];
$crm_fromclue = $row['crm_fromclue'];

$crm_usjtime1 = $row['crm_usjtime1'];
$crm_usjtime2 = $row['crm_usjtime2'];
$crm_qxnum = $row['crm_qxnum'];
$crm_yjnum = $row['crm_yjnum'];

$agenttitle=(!empty($agenttitle))?$agenttitle:'';
//
$address    = dataIO($row['address'],'out');
$weixin     = dataIO($row['weixin'],'out');
$qq         = dataIO($row['qq'],'out');
$email      = dataIO($row['email'],'out');
$mob        = dataIO($row['mob'],'out');
$mob2        = dataIO($row['mob2'],'out');
$weixin_pic = $row['weixin_pic'];
//
$mate_age1      = intval($row['mate_age1']);
$mate_age2      = intval($row['mate_age2']);
$mate_heigh1    = intval($row['mate_heigh1']);
$mate_heigh2    = intval($row['mate_heigh2']);
$mate_pay       = $row['mate_pay'];
$mate_edu       = $row['mate_edu'];
$mate_areaid    = $row['mate_areaid'];
$mate_areatitle = $row['mate_areatitle'];
$mate_love      = $row['mate_love'];
$mate_car       = $row['mate_car'];
$mate_house     = $row['mate_house'];
$mate_weigh1      = intval($row['mate_weigh1']);
$mate_weigh2      = intval($row['mate_weigh2']);
$mate_job         = $row['mate_job'];
$mate_child       = $row['mate_child'];
$mate_marrytime   = $row['mate_marrytime'];
$mate_companykind = $row['mate_companykind'];
$mate_smoking     = $row['mate_smoking'];
$mate_drink       = $row['mate_drink'];
$mate_areaid2     = $row['mate_areaid2'];
$mate_areatitle2  = $row['mate_areatitle2'];
$mate_other       = $row['mate_other'];
//
$mate_age       = $mate_age1.','.$mate_age2;
$mate_age_str   = mateset_out($mate_age1,$mate_age2,'岁');
$mate_age_str = str_replace("不限","",$mate_age_str);

$heigh_arr = json_decode($_UDATA['heigh'],true);
$heigh_dw  = $heigh_arr['dw'];
$weigh_arr = json_decode($_UDATA['weigh'],true);
$weigh_dw  = $weigh_arr['dw'];

$mate_heigh     = $mate_heigh1.','.$mate_heigh2;
$mate_heigh_str = mateset_out($mate_heigh1,$mate_heigh2,$heigh_dw);
$mate_heigh_str = str_replace("不限","",$mate_heigh_str);
$mate_weigh     = $mate_weigh1.','.$mate_weigh2;
$mate_weigh_str = mateset_out($mate_weigh1,$mate_weigh2,$weigh_dw);
$mate_weigh_str = str_replace("不限","",$mate_weigh_str);
$mate_areaid_str  = (!empty($mate_areatitle))?$mate_areatitle:'';
$mate_areaid2_str = (!empty($mate_areatitle2))?$mate_areatitle2:'';
$mate_pay_str   = udata('pay',$mate_pay);
$mate_edu_str   = udata('edu',$mate_edu);
$mate_love_str  = udata('love',$mate_love);
$mate_car_str   = udata('car',$mate_car);
$mate_house_str = udata('house',$mate_house);
$mate_job_str         = udata('job',$mate_job);
$mate_child_str       = udata('child',$mate_child);
$mate_marrytime_str   = udata('marrytime',$mate_marrytime);
$mate_companykind_str = udata('companykind',$mate_companykind);
$mate_smoking_str     = udata('smoking',$mate_smoking);
$mate_drink_str       = udata('drink',$mate_drink);
//
$nickname = trimhtml(dataIO($row['nickname'],'out'));
$sex      = $row['sex'];
$grade    = $row['grade'];
$photo_s  = $row['photo_s'];
$photo_f  = $row['photo_f'];
$photo_ifshow  = $row['photo_ifshow'];
$regtime  = YmdHis($row['regtime'],'Ymd');
$endtime  = YmdHis($row['endtime'],'Ymd');
$flag     = $row['flag'];
//
if(!empty($photo_s)){
	if($photo_ifshow==0){
		$photo_m_url = RES.'photo_m'.$sex.'_hide.png';	
	}else{
		$photo_m_url = $_ZEAI['up2'].'/'.smb($photo_s,'m');
	}
	$photo_m_str = '<img src="'.$photo_m_url.'?'.ADDTIME.'">';
}else{
	$photo_m_url = HOST.'/res/photo_m'.$sex.'.png';
	$photo_m_str = '<img src="'.$photo_m_url.'">';
}
$photo_s_url = (!empty($photo_s))?$_ZEAI['up2'].'/'.$photo_s:HOST.'/res/photo_s'.$sex.'.png';
$nickname = (empty($nickname))?$uname:$nickname;
$kf_tel=dataIO($_ZEAI['kf_tel'],'out');$kf_mob=dataIO($_ZEAI['kf_mob'],'out');$kf_wx=dataIO($_ZEAI['kf_wx'],'out');
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="<?php echo HOST;?>/res/www_zeai_cn.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<link href="css/main.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css">
<style type="text/css">
.table .tdL{width:14%;color:#888}
.table .tdR{width:36%}
.table td{padding:1px 10px;border:1px solid #eee}
.printbox{width:700px;position:relative;margin:50px auto 70px auto;background-color:#fff}
.printbox .photobox{position:absolute;top:0;right:0}
.printbox .photobox img{width:150px;height:181px;padding:8px;border:#eee 1px solid;display:block;background-color:#fff;padding:8px;object-fit:cover;-webkit-object-fit:cover}
.printbox ul{padding:10px 10px 0 10px}
.printbox ul li{display:inline-block;padding:0 10px;line-height:22px;border-radius:20px;border:#eee 1px solid;margin:0 10px 10px 0;color:#888}
.printbox ul li b{color:#000;font-weight:normal}
/* width="680"*/
</style>
</head>
<body class="body">
<!--startprint-->
<div class="printbox">
<table class="table W700">
    <tr><td height="30" colspan="4" align="left" ><b class="S18">个人资料</b></td></tr>
    <tr>
    <td class="tdL">网　　名</td><td colspan="3" class="tdR"><?php echo $nickname; ?>（UID：<?php echo $uid; ?>）</td>
    </tr>
    <tr><td class="tdL">性　　别</td><td colspan="3" class="tdR"><?php echo udata('sex',$sex); ?></td>
    </tr>
    <tr>
    <td class="tdL">婚　　况</td><td colspan="3" class="tdR">
    <?php
    echo udata('love',$love);
    if(!empty($child)){echo '（'.udata('child',$child).'）';}
    ?>
    </td>
    </tr>
    <tr>
    <td class="tdL">生　　日</td>
    <td colspan="3" class="tdR"><?php echo $birthday.$age; ?></td>
    </tr>
    <tr>
    <td class="tdL">民　　族</td>
    <td colspan="3" class="tdR"><?php echo udata('nation',$nation); ?></td>
    </tr>
    <tr><td class="tdL">身　　高</td><td class="tdR"><?php echo udata('heigh',$heigh); ?></td>
    <td class="tdL">体　　重</td>
    <td class="tdR"><?php echo udata('weigh',$weigh); ?></td>
    </tr>
    <tr><td class="tdL">月　　薪</td><td class="tdR"><?php echo udata('pay',$pay); ?></td>
    <td class="tdL">学　　历</td>
    <td class="tdR"><?php echo udata('edu',$edu); ?></td>
    </tr>
    <tr><td class="tdL">房　　子</td><td class="tdR"><?php echo udata('house',$house); ?></td>
    <td class="tdL">车　　子</td>
    <td class="tdR"><?php echo udata('car',$car); ?></td>
    </tr>
    <tr><td class="tdL">职　　业</td><td class="tdR"><?php echo udata('job',$job); ?></td>
    <td class="tdL">结婚时间</td>
    <td class="tdR"><?php echo udata('marrytime',$marrytime); ?></td>
    </tr>
    <tr><td class="tdL"><span class="textmiddle">地　　区</span></td><td class="tdR"><?php echo $areatitle; ?></td>
    <td class="tdL">户　　籍</td>
    <td class="tdR"><?php echo $area2title; ?></td>
    </tr>
    <tr><td class="tdL">自我介绍</td><td colspan="3" class="tdR"><?php echo $aboutus; ?></td></tr>
    <tr><td class="tdL">红娘评价</td><td colspan="3" class="tdR"><?php echo $hnbbs; ?></td></tr>
    <tr><td height="30" colspan="4" align="left" ><b class="S18">择偶要求</b></td></tr>
	<?php
	$mate_diy = explode(',',$_ZEAI['mate_diy']);
	if(!empty($mate_age1) || !empty($mate_age2) || !empty($mate_heigh1) || !empty($mate_heigh2) || !empty($mate_pay) || !empty($mate_edu) || !empty($mate_areatitle) || !empty($mate_love) || !empty($mate_house) || !empty($mate_other) ){
		if (count($mate_diy) >= 1 && is_array($mate_diy)){?>
        	<tr><td class="tdL">希望另一半</td><td colspan="3" class="tdR">
            <ul>
            <?php
			foreach ($mate_diy as $k=>$V) {
				$tmpm     = 'mate_'.$V.'_str';
				$mate_str = $$tmpm;
				if(!empty($mate_str)){echo '<li>'.mate_diy_par($V).'：<b>'.$mate_str.'</b></li>';}
			}?>
            </ul>
            </td></tr>
			<?php
		}
	}
    if(!empty($mate_other)){?><tr><td class="tdL">其他要求</td><td colspan="3" class="tdR"><?php echo dataIO($mate_other,'wx'); ?></td></tr><?php }?>
    
    <style>
	.copybtm td{border:0;}
    </style>
    <tr><td height="111" colspan="4"><table width="100%" border="0" class="copybtm">
      <tr>
        <td width="33%" align="left" style="line-height:200%;color:#888">
<div class="S14 C000">联系我们</div>
电话：<?php echo (!empty($kf_tel))?$kf_tel:$kf_mob;?><br>
网址：<?php echo HOST;?><br>      
微信：<?php echo $kf_wx;?><br>      
        </td>
        <td width="33%" class="center"><img id="gzh" src="<?php echo UP.$_GZH['wx_gzh_ewm'];?>" width="100" height="100"><div class="S12 C999" style="margin-bottom:10px">关注公众号查看更多</font></td>
        <td width="33%" class="center"><img id="uhome" src="<?php echo HOST;?>/sub/creat_ewm.php?url=<?php echo mHref('u',$uid);?>" width="100" height="100"><div class="S12 C999" style="margin-bottom:10px">扫码浏览会员资料</font></td>
      </tr>
    </table></td></tr>
    
    <tr>
      <td colspan="4" bgcolor="#fafafa" >本会员信息由【<?php echo dataIO($_ZEAI['siteName'],'out');?>】提供　个人资料均已通过审核</td></tr>
    
</table>
<div class="photobox"><img src="<?php echo $photo_m_url;?>" id="photo_s"></div>
</div>
<!--endprint-->
<div class="savebtnbox"><button class="btn size3" type="button" onClick="doPrint()" /><i class="ico">&#xe6dd;</i> 开始打印</button></div>
<script>
    function doPrint() {
        bdhtml=window.document.body.innerHTML;
        sprnstr="<!--startprint-->";
        eprnstr="<!--endprint-->";
        prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17);
        prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));
        window.document.body.innerHTML=prnhtml;
        window.print();
        window.document.body.innerHTML=bdhtml;
    }
	function getBase64Image(img) {
	  var canvas = document.createElement("canvas");
	  canvas.width = img.width;
	  canvas.height = img.height;
	  var ctx = canvas.getContext("2d");
	  ctx.drawImage(img, 0, 0, img.width, img.height);
	  var ext = img.src.substring(img.src.lastIndexOf(".")+1).toLowerCase();
	  var dataURL = canvas.toDataURL("image/"+ext);
	  return dataURL;
	}
	//
	var image = new Image();
	image.crossOrigin = '';
	image.src = "<?php echo $photo_m_url;?>";
	image.onload = function(){
		photo_s.src=getBase64Image(image);
	}
	//
	var image2 = new Image();
	image2.crossOrigin = '';
	image2.src = "<?php echo UP.$_GZH['wx_gzh_ewm'];?>";
	image2.onload = function(){
		gzh.src=getBase64Image(image2);
	}
	//
	var image3 = new Image();
	image3.crossOrigin = '';
	image3.src = "<?php echo HOST;?>/sub/creat_ewm.php?url=<?php echo mHref('u',$uid);?>";
	image3.onload = function(){
		uhome.src=getBase64Image(image3);
	}
</script>
<?php require_once 'bottomadm.php';?>